<?php

	class Controller {
		//var $_root = "";
		var $_controlled_class;
		//var $_use_session = TRUE;
		var $_search_fields = array();
		var $accessLevels = array();
		var $_ajax_methods = array();
		var $_method_resolve = array();
		var $template;
		var $application;
		var $noRender = FALSE;
		
		function Controller($app=NULL){
			$this->application =& $app;
			$this->_controlled_class = substr(get_class($this),0,-10); 
			$this->initialize();
		}
		
		function initialize(){
		}
		
		function load($view_name,$data=null){
			/*ob_start();
			if($data!=null){
				foreach($data as $var => $value){
					$$var = $value;         
				}
			}
			include("application/views/".$view_name.".php");
			$contenido = ob_get_contents();
			ob_end_clean();
			return $contenido;*/
		}
		function error($message=""){
			$this->template->set("error","<div id=\"error\">".$message."</div>");
		}
		function renderTemplate($viewName,$data=array()){
			import("framework.view.Template");
			$temp = new Template();
			$temp->setView("application/views/".$viewName);
			foreach($data as $key=>$value){
				$temp->set(strToLower($key),$value);
			}
			return $temp->render();
		}
		function setTemplate(&$template){
			$this->template =& $template;
		}
	}

?>